package book;

public class BookList {
    private Book[] books = new Book[10];
    private int usedSize;

    //通过构造方法为数组预存3本书
    public BookList() {
        this.books[0] = new Book("三国演义", "罗贯中", 80, "小说");
        this.books[1] = new Book("西游记", "吴承恩", 18, "小说");
        this.books[2] = new Book("红楼梦", "曹雪芹", 89, "小说");

        usedSize = 3;
    }

    //设置,获取usedSize
    public int getUsedSize() {
        return usedSize;
    }
    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }

    //获取当前位置的书
    public Book getPos(int pos) {
        return books[pos];
    }

    //添加新书
    public void setBooks(Book book, int currentSize) {
        books[currentSize] = book;
    }
}
